/*
 * datasave.h
 *
 *  Created on: Apr 24, 2014
 *      Author: killerg
 */

#ifndef DATASAVE_H_
#define DATASAVE_H_


#include "share/cs_msg.pb.h"

using namespace cs;

struct datasave_sprite_t {
	int32_t serial;
	int32_t proto;
	int8_t skill_level[SpriteSkillNum];
};

struct datasave_pet_t {
	int32_t serial;
	int64_t pe8s[EPeAtt8Save_ARRAYSIZE];
	double peds[EPeAttDSave_ARRAYSIZE];
	int32_t pe4s[EPeAtt4Save_ARRAYSIZE];
	char pess[EPeAttSSave_ARRAYSIZE][ShortStringLen];
};

struct datasave_item_t {
	int32_t serial;
	int32_t proto;
	int32_t num;
};

struct datasave_equip_t {
	int32_t level;
	int32_t enhance;
	int32_t star_num[CanSeePetAttNum];
};

struct datasave_bosslevel_t {
	int32_t id;
	int32_t cur_pass;
	int32_t haspass;
	int32_t reset_count;
};

struct datasave_giftlog_t {
	int32_t time;
	int32_t type;
	char to[ShortStringLen];
	char from[ShortStringLen];
};

struct datasave_arenalog_t {
    char attacker[ShortStringLen];
    char defender[ShortStringLen];
    bool win;
    int index;
};

struct datasave_train_t {
	int32_t type;
	int32_t lvl;
	int32_t finish;
	int32_t petid;
	int32_t petlvl;
};

struct datasave_player_t {
	int64_t id;
	int32_t create;
	char account[32];
	int32_t valid_pet_serial;
    int32_t valid_item_serial;
    int32_t valid_sprite_serial;
    int32_t code;
    int32_t code_trytime;
    int32_t logoff_date;
    int32_t week_refresh_time;
    int32_t compensate_gain_stamp;
    int8_t forbid;	// forbid broad speek

    datasave_item_t items[PlayerMaxBagPageNum * PlayerBagSlotNumPerPage];
    datasave_pet_t pets[PlayerMaxPetNum];
    datasave_sprite_t sprites[PlayerMaxSpriteNum];
    datasave_equip_t equips[PlayerEquipSlotNum];

	int64_t pl8s[EPlAtt8Save_ARRAYSIZE];
	double plds[EPlAttDSave_ARRAYSIZE];
	int32_t pl4s[EPlAtt4Save_ARRAYSIZE];
	char plss[EPlAttSSave_ARRAYSIZE][32];
	datasave_bosslevel_t bosslevels[MaxLevelNum / 6];
	int32_t pet_seen[120 * 3];
	int32_t pet_has[120 * 3];
	int32_t level_has[MaxLevelNum / 32 + 1];
	int64_t friends[MaxFriendNum];
	int64_t friends_combat[MaxFriendNum];
	datasave_giftlog_t giftlogs[6];
	int32_t alives[8];
	datasave_train_t trains[MaxTrainRoomNum];
};


#endif /* DATASAVE_H_ */
